package com.com.typhoon.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;

import java.lang.reflect.Method;

/**
 * @author shuya | dongfeng.zdf@alibaba-inc.com
 * @description
 * @date 2018/10/22 下午2:18
 * @description
 * @modified by
 * @since V2.0.0
 */
@Slf4j
public class AsyncExceptionHandler implements AsyncUncaughtExceptionHandler {
    @Override
    public void handleUncaughtException(Throwable throwable, Method method, Object... objects) {
        StringBuilder builder = new StringBuilder();
        for (Object param : objects) {
            builder.append(",").append(param);
        }
        log.error("Method name - {},Parameter values-{}, Exception Cause - {}",builder.toString(),method.getName(),throwable.getMessage());
    }
}
